//version:1.0.0
    export default {
        data() {
            return {
                form:{
                    bab010: {
                        value: '',
                        p: 'R'
                    },
                    aae041: {
                        value: '',
                        p: 'E'
                    },
                    aaa058: {
                        key: '',
                        value: '',
                        p: 'E'
                    },
                    aae160: {
                        value: '',
                        p: 'E'
                    },

                },
                tableData: {},

                rules:{
                    bab010: [
                         {required: true, validator: this.$rules.test_noBlank, trigger: 'blur'}

                    ],

                },
                codeTypes:{

                },
                codeTypeFilters:{

                },
                pager: {
	                page: 1,
	                size: 10
            	},
            	total: 0,
            }
        },
        computed: {
            functionId() {
                if (this.$store.getters.init.path !== this.$route.path) return;
                if (this.$store.getters.init.mdParam === null || this.$store.getters.init.mdParam === undefined) return;
                if (this.$store.getters.init.mdParam.functionid === undefined) return;
                return this.$store.getters.init.mdParam.functionid;
            },
            backFun() {
                return this.$store.getters.backFun;
            },
            init_formData() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.form;
            },
            doInitformData: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.formData;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },

        },
        created() {
            let param = {
                path: this.$route.path,
                codeTypes:this.codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:this.form,
                tableData:this.tableData

            };
            if (this.$route.query.keepAlive === undefined) {
                this.$store.dispatch('SET_INIT', param);
            }
        },
        watch: {
            init_formData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            doInitformData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },

            backFun: {
                handler(value) {
                    if (value === null) return;
                    this.customBackFun();
                    let backFun = [];
                    backFun = value.split(',');
                    if (backFun.indexOf('rDoInit') >= 0) {
                let codeTypes = {

                };
                let form = {
                    bab010: {
                        value: '',
                        p: 'R'
                    },
                    aae041: {
                        value: '',
                        p: 'E'
                    },
                    aaa058: {
                        key: '',
                        value: '',
                        p: 'E'
                    },
                    aae160: {
                        value: '',
                        p: 'E'
                    },

                };
                let tableData= {};

            let param = {
                path: this.$route.path,
                codeTypes:codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:form,
                tableData:tableData

            };
                        this.$store.dispatch('SET_INIT', param);
                    }
                }
            }
        },
        mounted() {
            if (this.$store.getters.cacheData === null) return;
            if (this.$store.getters.cacheData[this.$route.path] === undefined)  return;
            if (this.$store.getters.cacheData[this.$route.path].path !== this.$route.path) return;
            if (this.$store.getters.cacheData[this.$route.path].form !== undefined) {
                this.getformData(this.$store.getters.cacheData[this.$route.path].form);
            }

        },
        beforeRouteLeave(to, from, next) {
            let param = {
                path: this.$route.path,
                codeTypes: this.$store.getters.codeTypes,
                codeTypeFilters: window.btoa(JSON.stringify(this.codeTypeFilters)),
                form:this.form,
                tableData:this.tableData

            };
            if (from) {
                this.$store.dispatch('SET_CACHEDATA', param);
            }
            next();
        },
        methods: {
            getformData(value) {
                this.form = value;
            },


            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleEdit(id) {
                this.dialogFormVisible = true;
            },

            customBackFun(){//自定义方法体
},
        },
    }
